core: pause/resume primitive for wall-driven auto slab+ceiling sync#336
Merged
Conversation
initSpaceDetectionSync subscribes to every scene mutation and auto-derives slabs/ceilings from wall topology. When a host app drives explicit slab/ceiling creation (e.g. the community editor's AI create_room flow), the auto-sync races those nodes and the polygon-signature de-dupe is fragile enough that duplicates leak through. Expose pauseSpaceDetection / resumeSpaceDetection / isSpaceDetectionPaused mirroring the existing pauseSceneHistory refcount in store/history-control. While paused, the subscriber rolls previousSnapshots forward so resume does NOT trigger a backfill that would re-introduce the very duplicates the host paused to avoid. No behavior change for callers that don't touch the new functions.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
initSpaceDetectionSyncinpackages/core/src/lib/space-detection.tssubscribes to every scene mutation and auto-derives slabs/ceilings from wall topology. When a host app drives explicit slab/ceiling creation (e.g. the community editor's AIcreate_roomflow, which builds zone → slab → ceiling → walls in sequence), the auto-sync races those nodes and the polygon-signature de-dupe insyncAuto*ForLevelis fragile enough that duplicateautoFromWalls: truenodes leak through.This adds a refcount primitive, mirroring
pauseSceneHistoryinstore/history-control.ts:pauseSpaceDetection()/resumeSpaceDetection()/isSpaceDetectionPaused()— exported from@pascal-app/core.previousSnapshotsforward so resume does NOT backfill paused-period changes (otherwise duplicates just shift in time).No behavior change for callers that don't touch the new functions. The community editor wires this up via
useAISessionin a follow-up commit onpascalorg/private-editor.How to test
cd packages/core && bun run build && bun test src/lib/space-detection-pause.test.ts— the 4 new unit cases for the refcount should pass.packages/core:bun testfrom the core package root. The pre-existingsyncAutoStairOpeningsfailures insrc/systems/stair/stair-opening-sync.test.ts(visible onmain) are unchanged by this branch.import { pauseSpaceDetection, resumeSpaceDetection, isSpaceDetectionPaused } from '@pascal-app/core'— types resolve, runtime calls toggle the depth as expected.Screenshots / screen recording
N/A — non-visual change (new exports + subscriber gating; no rendering or UI affected).
Checklist
bun dev